package com.ruixi.spring.datasource;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.SQLException;

public class Test {
    public static void main(String[] args) throws SQLException {
        //引用外部属性文件
        ApplicationContext ac = new ClassPathXmlApplicationContext("conf/applicationContext.xml");
        DruidDataSource datasource = ac.getBean("datasource", DruidDataSource.class);
        DruidPooledConnection connection = datasource.getConnection();
        System.out.println(connection);

    }
}
